#include<iostream>
using namespace std;
int main()
{
	int xz,_xz,xy,_xy,yz,_yz;
	int x0,y0,z0;
	int x,y,z;
	cin>>x>>y>>z;
	cin>>x0>>y0>>z0;
	cin>>xz>>_xz>>xy>>_xy>>yz>>_yz;
	int total=0;
	if(x>x0)
		total+=_yz;
	else if(x<0)
		total+=yz;
	else
		total=total;
	if(y>y0)
		total+=_xz;
	else if(y<0)
		total+=xz;
	else
		total=total;
	if(z>z0)
		total+=_xy;
	else if(z<0)
		total+=xy;
	else
		total=total;
	cout<<total<<endl;
    return 0;
}
